<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/common.js"></script>
</head>
<body>
<h3>会员登录</h3>
<form action="login.php" method="get" onsubmit="return check()">
    账号: <input type="text" name="name" id="name"><br>
    <input type="submit" value="登录">&nbsp;
</form>

<script>
    /* 最简单的表单验证 */
    function check(){
        var n = i('name');
        if(n.value==''){
            alert('请填写账号');
            n.focus();
            return false;
        }else if(n.value.trim().length<5 || n.value.trim().length>12){
            alert('账号长度必须是5-12位');
            n.value = '';
            n.focus();
            return false;
        }

        return true;
    }
</script>
</body>
</html>